package com.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.user.dao.coupon.MyCoupon;
import com.user.dao.coupon.UserHaveCoupon;
import com.user.domain.UserCoupon;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author YU
 * @description 针对表【user_coupon】的数据库操作Mapper
 * @createDate 2024-05-19 10:48:07
 * @Entity .com.user.com.user.domain.UserCoupon
 */
public interface UserCouponMapper extends BaseMapper<UserCoupon> {

    List<UserHaveCoupon> selectUserCoupon(int i);

    @Select("select count(*) from user_coupon where coupon_id = #{couponId} and user_id = #{userId}")
    Integer selectUserCouponByCouponIdAndUserId(Integer couponId, Integer userId);

    @Select("select coupon_id from user_coupon where user_id = #{userId}")
    List<Integer> selectUserCouponByUserId(Integer userId);

    List<MyCoupon> selectMyCoupon(@Param("userId") Integer userId);
}




